﻿@model GsifWeb4.ViewModels.PlayerViewModel

<table style ="line-height:12px">
    <tr>
        <td colspan="2">
            <h2>@Model.Name</h2>
        </td>
    </tr>
    <tr>
        <td>
            <img src="@Model.Image" height="200">	
        </td>
        <td>
            <table border="0">
                <tr>
                    <td><b>Position:</b></td>
                    <td>@Model.Position</td>
                </tr>
                <tr>
                    <td><b>Född:</b></td>
                    <td>@Model.Born</td>
                </tr>
                <tr>
                    <td><b>Längd:</b></td>
                    <td>@Model.Length</td>
                </tr>
                <tr>
                    <td><b>Vikt:</b></td>
                    <td>@Model.Weight</td>
                </tr>
                <tr>
                    <td><b>Moderklubb:</b></td>
                    <td>@Model.MotherClub</td>
                </tr>
                <tr>
                    <td><b>Motto:</b></td>
                    <td>@Model.Motto</td>
                </tr>
                <tr>
                    <td><b>Matchens lirare:</b></td>
                    <td>@Model.ManOfTheMatch</td>
                </tr>
                <tr>
                    <td><b> </b></td>
                    <td> </td>
                </tr>
                <tr>
                    <td><b>Spelade matcher:</b></td>
                    <td>@Model.TotalGames</td>
                </tr>
                <tr>
                    <td>Försvar:</td>
                    <td>@Model.TotalDefender</td>
                </tr>
                <tr>
                    <td>Mittfält:</td>
                    <td>@Model.TotalMidfielder</td>
                </tr>
                <tr>
                    <td>Anfall:</td>
                    <td>@Model.TotalForward</td>
                </tr>
                <tr>
                    <td>Avbytare:</td>
                    <td>@Model.TotalSubstitute</td>
                </tr>
            </table>
        </td>
    </tr>
</table>

    <table border="0">
        <tr>
									<td colspan="2"><b>Deltagit i matcher</b></td>
                                    <td></td>
                                    <td></td>
									<td><img src="~/Images/SiteImages/mal.gif" alt="Mål" border=0/></td>
									<td><img src="~/Images/SiteImages/assist.gif" alt="Assist" border=0/></td>
									<td><img src="~/Images/SiteImages/Varning.gif" alt="Varning" border=0/></td>
									<td><img src="~/Images/SiteImages/Utvisning.gif" alt="Utvisning" border=0/></td>
									<td><img src="~/Images/SiteImages/manOfMatch.gif" alt="Matchens lirare" border=0/></td>
		</tr>
            @{						
    int currentYear = -1;
    foreach (var match in Model.Matches.OrderByDescending(m => m.Date))
    {
            if (currentYear != match.Year)
               {
                   currentYear = match.Year;
                    <tr>
                        <td colspan="9"></td>
                   </tr>
                   <tr>
                        <td colspan="9"><b>@currentYear</b></td>
                   </tr>
                      
                }
            <tr>
                <td>@match.Year</td>
                <td>@Html.ActionLink("GSIF-" + match.Opponent, "Details", "MatchReport", new {ID = match.Id}, null)</td>
                <td>@match.Result</td>
                <td><@match.Round</td>
                <td>@(match.Goals > 0 ? match.Goals.ToString() : "")</td>
                <td>@(match.Assists > 0 ? match.Assists.ToString() : "")</td>
                <td>@(match.YellowCard > 0 ? match.YellowCard.ToString() : "")</td>
                <td>@(match.RedCard > 0 ? match.RedCard.ToString() : "")</td>
                <td>@if (!string.IsNullOrEmpty(match.ManOfTheMatch))
                            {  
                            <img src="~/Images/SiteImages/manOfMatch.gif" alt="M"/>
                }
                            </td>
            </tr>
    }
            }
    </table>
